<?php
include 'includes.php';

?>


<!-- Bootstrap core CSS -->


<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="">
        <meta name="author" content="">
        <link rel="shortcut icon" href="../../assets/ico/favicon.ico">
        <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
        <link href="bootstrap/css/bootstrap.css" rel="stylesheet">
        <link href="bootstrap/css/css.css" rel="stylesheet">
        <script type="text/javascript" src="bootstrap/js/jquery-1.11.0.min.js"></script>

        <title>The Pengüins mafia Bis List - Editar PJ</title>

    </head>


<?php
include './cabecera.php';


?>




<!-- Main jumbotron for a primary marketing message or call to action -->


<div class="container contenido">

    <div class="page-header">
        <h2>Personajes <small>Gestiona tus personajes</small></h2>
    </div>
</div>

<?php
if (isset($_SESSION['user'])) {
?>

<div class="container">
    <!-- Example row of columns -->
    <div class="row">
        <div class="col-md-1">
            <button type="button" class="btn btn-success btn-md" onclick="window.location.href = 'addpj.php'">
                <span class="glyphicon glyphicon-plus"></span> Añadir
            </button>
        </div>
    </div>
    <br />

    <?php
    $user = R::load('usuarios', $_SESSION['user']['id']);

    $pj = R::getAll('select * from pjs where usuario_id = :id', [':id' => $user->id]);

    $i = 0;


    foreach($pj as $personaje){

        if($personaje['clase'] == 'Druida') {      
            $iconoclase = "imagenes/Druid Icono.png";
        }else if($personaje['clase'] == 'Warlock') {      
            $iconoclase = "imagenes/Warlock Icono.png";
        }else if($personaje['clase'] == 'Warrior') {      
            $iconoclase = "imagenes/Warrior Icono.png";
        }else if($personaje['clase'] == 'Chaman') {      
            $iconoclase = "imagenes/Shaman Icono.png";
        }else if($personaje['clase'] == 'Monje') {      
            $iconoclase = "imagenes/Monk Icono.png";
        }else if($personaje['clase'] == 'DK') {      
            $iconoclase = "imagenes/DK Icono.png";
        }else if($personaje['clase'] == 'Priest') {      
            $iconoclase = "imagenes/Priest Icono.png";
        }else if($personaje['clase'] == 'Hunter') {      
            $iconoclase = "imagenes/Hunter Icono.png";
        }else if($personaje['clase'] == 'Rogue') {      
            $iconoclase = "imagenes/Rogue Icono.png";
        }else if($personaje['clase'] == 'Mago') {      
            $iconoclase = "imagenes/Mage Icono.png";
        }else if($personaje['clase'] == 'Paladin') {      
            $iconoclase = "imagenes/Paladin Icono.png";
        }        
        
        
        
        if($personaje['rol'] == 'Tanke') {
            $iconorol = "imagenes/Tank Icono.png";
        }else if($personaje['rol'] == 'Heal') {
          $iconorol = "imagenes/Heal Icono.png";  
        }else if($personaje['rol'] == 'DPS Melee') {
          $iconorol = "imagenes/Dps Icono.png";  
        }else if($personaje['rol'] == 'DPS Caster') {
          $iconorol = "imagenes/Dps Icono.png";
        }
        
    echo "

            <div class = 'row'>
            <div class = 'col-md-1 vcenter'>
            
            <img class='imgclaseGrande' src ='".$iconoclase."'/>
    </div>
    <div class = 'col-md-1  vcenter'>
    <img class='imgclaseGrande' src = '".$iconorol."'/>
    </div>
    <div class = 'col-md-4 vcenter'>
    ".$personaje['nick']."
    </div>
    <div class = 'col-md-1 vcenter'>

    <button type = 'button' class = 'btn btn-info btn-md' onclick=\"window.location.href='editarpj.php?id=".$personaje['id']."'\">
    <span class = 'glyphicon glyphicon-pencil'></span> Editar
    </button>
    <button type = 'button' class = 'btn btn-danger btn-md' onclick=\"window.location.href='borrarpj.php?id=".$personaje['id']."'\">
    <span class = 'glyphicon glyphicon-trash'></span> Eliminar
    </button>

    </div>

    </div><br/>
    ";
    }
    ?>



    <hr>

</div> <!-- /container -->
<?php
}
?>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->


<?php
include 'pie.php';
?>